<?php
/**
 * Created by PhpStorm.
 * User: CJJ
 * Date: 2017/8/28
 * Time: 9:30
 */
error_reporting(0);
header("Content-type:text/html;charset=utf-8");
$File=$_FILES['UserFile'];
$Dir=explode('\\',dirname(__FILE__));$CDir=$Dir[0];for($i=1;$i<count($Dir)-2;$i++) $CDir.='/'.$Dir[$i];
$FilePath.=$CDir.'/Images/Sign/';

// echo $CDir;
if(SaveExcel($File,$FilePath,$_POST['UserNumber']))
    echo '上传成功！';
else
    echo '上传失败！';

function SaveExcel($File,$CDir,$UserNumber)
{
    $FileName = $UserNumber . substr($File['name'], strripos($File['name'], '.'));
    $FilePath = $CDir.$FileName;
//    echo $FilePath;
    if(move_uploaded_file($File['tmp_name'], $FilePath))
    return $FilePath;
else
    return false;
}